﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <!--[if lt IE 9]>
    <script type="text/javascript" src="lib/html5.js"></script>
    <script type="text/javascript" src="lib/respond.min.js"></script>
    <script type="text/javascript" src="lib/PIE_IE678.js"></script>
    <![endif]-->
    <link rel="stylesheet" type="text/css" href="static/h-ui/css/H-ui.min.css" />
    <link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/H-ui.admin.css" />
    <link rel="stylesheet" type="text/css" href="lib/Hui-iconfont/1.0.7/iconfont.css" />
    <link rel="stylesheet" type="text/css" href="lib/icheck/icheck.css" />
    <link rel="stylesheet" type="text/css" href="static/h-ui.admin/skin/default/skin.css" id="skin" />
    <link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/style.css" />
    <!--[if IE 6]>
    <script type="text/javascript" src="http://lib.h-ui.net/DD_belatedPNG_0.0.8a-min.js" ></script>
    <script>DD_belatedPNG.fix('*');</script>
    <![endif]-->
    <!--权限验证-->
    <script type="text/javascript" src="static/WebApi.js"></script>
    <title>估价列表</title>
</head>
<body>
    <!--top 导航-->
    <nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 估价列表 <span class="c-gray en">&gt;</span> 房产基本信息登记 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新"><i class="Hui-iconfont">&#xe68f;</i></a></nav>

    <!--Main 估价列表-->
    <div class="page-container">
        <div class="cl pd-5 bg-1 bk-gray mt-20">
            <span class="l">
                <a class="btn btn-primary radius" style="float:left;" onclick=" pledge_add('房产登记', 'AddUser.html' )" href="javascript:;"><i class="Hui-iconfont">&#xe600;</i> 登记</a>
                <span class="select-box" style="float:left;background-color:#ffffff;width:150px; margin:0px 5px;">
                    <select name="pledge_field" class="select" id="pledge_field">
                        <option value="项目号">项目号</option>
                        <option value="看房联系人">看房联系人</option>
                        <option value="房屋坐落">房屋坐落</option>
                    </select>
                </span>
                <input type="text" name="" id="number_search" placeholder="请选择查询条件信息进行查询" style="width:200px" class="input-text">
                <button name="" id="" class="btn btn-success" type="button" onclick="search()"><i class="Hui-iconfont">&#xe665;</i> 搜估价</button>
            </span>
            <span class="r">当前数据：<strong id="count">&nbsp;</strong> 条，共<strong id="pagecount"></strong>页</span>
        </div>
        <div class="mt-20">
            <table class="table table-border table-bordered table-bg table-hover table-sort">
                <thead>
                    <tr class="text-c">
                        <th width="80">项目号</th>
                        <th width="80">看房联系人</th>
                        <th width="100">看房联系人电话</th>
                        <th>房屋坐落</th>
                        <th width="120">登记日期</th>
                        <th width="100">项目状态</th>
                        <th width="200">操作</th>
                    </tr>
                </thead>
                <tbody></tbody>
                <tfoot id="myfoot"></tfoot>

            </table>
        </div>
    </div>

    <!--模态框-->
    <script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script>
    <script type="text/javascript" src="lib/layer/2.1/layer.js"></script>
    <script type="text/javascript" src="lib/My97DatePicker/WdatePicker.js"></script>
    <!-- <script type="text/javascript" src="lib/datatables/1.10.0/jquery.dataTables.min.js"></script>-->  <!--分页脚本，暂时注释-->
    <script type="text/javascript" src="static/h-ui/js/H-ui.js"></script>
    <script type="text/javascript" src="static/h-ui.admin/js/H-ui.admin.js"></script>
    <!--扩展js脚本-->
    <script type="text/javascript" src="static/Common.js"></script>
    <script type="text/javascript">

        /*估价信息-加载*/
        $(function () {
            Showdivisionmanagement("", 1, 10);
        });

        //根据项目号模糊查询，显示估价列表信息
        function Showdivisionmanagement(T_ReportNumber, pageindex, pagesize) {

            var pledge_field = $("#pledge_field").val();
            $.ajax({
                type: "post",
                url: ApiUrl + "api/Personal/SelectPersonalAllPage",
                data: { search: T_ReportNumber, PageIndex: pageindex, PageSize: pagesize, pledge_field: pledge_field },
                success: function (data, status) {//'+ item.P_ReportNumber + '
                    if (status == "success") {
                        $("tbody").empty();
                        $("#myfoot").empty();
                        $("#count").text(data.TotalSize);
                        $("#pagecount").text(data.PageCount);
                        var html = Array();
                        $(data.Result).each(function (i, item) {
                            html.push('<tr class="text-c">');
                            html.push('<td> ');
                            if (item.T_State > 2 && item.T_State != 4) {
                                html.push('<a class="btn btn-primary radius" data-title="勘查信息" _href="ExamineBase.html?T_ReportNumber=' + item.T_ReportNumber + '&T_State=' + item.T_State + '" onclick="Hui_admin_tab(this)" href="javascript:;">' + item.T_ReportNumber + '</a></td>');
                            } else if (item.T_State == 0) {
                                html.push('<a class="btn btn-primary radius" data-title="勘查信息" _href="ExamineBase.html?T_ReportNumber=' + item.T_ReportNumber + '&T_State=' + item.T_State + '" onclick="Hui_admin_tab(this)" href="javascript:;">' + item.T_ReportNumber + '</a></td>');
                            }
                            else {
                                html.push('<a class="btn btn-primary radius" data-title="勘查信息" _href="Base.html?T_ReportNumber=' + item.T_ReportNumber + '&T_State=' + item.T_State + '" onclick="Hui_admin_tab(this)" href="javascript:;">' + item.T_ReportNumber + '</a></td>');
                            }
                            html.push('<td>' + item.T_Linkman + '</td>');
                            html.push('<td>' + item.T_Phone + '</td>');
                            html.push('<td>' + item.T_Located + '</td>');
                            //html.push('<td>' + new Date(item.T_Date).Format("yyyy-MM-dd hh:mm:ss") + '</td>');
                            html.push('<td>' + item.T_Date + '</td>');
                            html.push('<td>' + item.T_StateText + '</td>');
                            html.push('<td class="f-14 td-manage">');
                            if (item.T_State > 2) {
                                html.push('<a class="btn btn-success radius" title="审核详情" onclick="pledge_TrialInfo(\'审核详情\',\'TrialInfo.html\',\'' + item.T_ReportNumber + '\')">审核详情</a>');
                            }
                            if (item.T_State == 0) {
                                html.push('<a class="btn btn-success radius" onclick="pledge_edit(\'编辑\', \'AddUser.html\', \'' + item.T_ReportNumber + '\')" title="未勘查预约之前可编辑">编辑</a>');
                                html.push('<a class="btn btn-success radius" onclick="pledge_del(this, ' + item.T_ReportNumber + ')" title="未勘查预约之前可删除">删除</a>');
                            }
                            if (item.T_State > 4 && item.T_State != 6) {
                                html.push('<a class="btn btn-success radius" title="导出抵押物初审意见书" onclick="download_Initia_laudit(' + item.T_ReportNumber + ')">导出</a>');
                            }
                            if (item.T_State > 6) {
                                html.push('<a class="btn btn-success radius" title="导出正式评估报告书" onclick="download_Formal_audit(' + item.T_ReportNumber + ')">导出</a>');
                            }


                            html.push('</td>');
                            html.push('</tr>');
                        });
                        $("tbody").append(html.join(""));


                        var page = Array();
                        page.push('<tr><td style="text-align:right;" colspan="7">');
                        if (pageindex > 1 && data.PageCount > 0) {
                            page.push('<input type="button"   class="btn btn-primary radius" onclick="Showdivisionmanagement(\'' + T_ReportNumber + '\',' + (pageindex - 1) + ',' + pagesize + ')" value="上一页" />');
                        }
                        page.push('<lable  style="font-size:16px" ">第' + pageindex + '页</label>');
                        if (pageindex < data.PageCount && data.PageCount > 0) {
                            page.push('<input  type="button"  class="btn btn-primary radius" onclick="Showdivisionmanagement(\'' + T_ReportNumber + '\',' + (pageindex + 1) + ',' + pagesize + ')" value="下一页" />');
                        }

                        page.push('</tr>');
                        var d1 = page.join("");
                        $("#myfoot").append(d1);
                    }
                }
            });
        };

        //查询功能
        function search() {
            var T_ReportNumber = $("#number_search").val();
            Showdivisionmanagement(T_ReportNumber, 1, 10);
        }

        /*房产抵押基本信息-登记*/
        function pledge_add(title, url) {
            var index = layer.open({
                type: 2,
                title: title,
                content: url
            });
            layer.full(index);
        }

        /*房产抵押基本信息-编辑*/
        function pledge_edit(title, url, id) {
            var index = layer.open({
                type: 2,
                title: title,
                content: url + "?" + id
            });
            layer.full(index);
        }

        //审核详情
        function pledge_TrialInfo(title, url, id) {
            var index = layer.open({
                type: 2,
                title: title,
                content: url + "?" + id
            });
            layer.full(index);
        }

        /*房产抵押基本信息-删除-未预约勘查信息之前可以删除*/
        function pledge_del(obj, id) {
            parent.layer.confirm('确认要删除吗？', function () {
                $.ajax({
                    type: "post",
                    url: ApiUrl + "api/Personal/delete",
                    data: { "": id },
                    //contentType: 'application/json',
                    success: function (data, status) {
                        if (status == "success") {
                            if (data == true) {
                                parent.layer.msg('已删除!', { icon: 1, time: 1000 });

                                $(obj).parents("tr").remove();
                            }
                        }
                    }
                });
            });

        };

        /*导出抵押物初审意见书*/
        function download_Initia_laudit(T_ReportNumber) {
            layer.msg('正在导出抵押物初审意见书....', {
                icon: 16, shade: 0.01
            });
            $.ajax({
                url: ApiUrl + "api/Examination/Thetrial",
                type: 'post',
                data: { "": T_ReportNumber },
                success: function (data) {
                    if (data.code == 0) {
                        parent.layer.msg(data.msg, { icon: 2, time: 1000 });
                    }
                    else {
                        parent.layer.msg("导出成功！", { icon: 1, time: 1000 });
                        location.href = "" + ApiUrl + data.msg;
                    }
                }
            });

            //location.href=''
        };

        /*导出公积金贷款二手房担保方式正式报告*/
        function download_Formal_audit(T_ReportNumber) {
            layer.msg('正在导出公积金贷款二手房担保方式正式报告....', {
                icon: 16, shade: 0.01
            });
            $.ajax({
                url: ApiUrl + "api/Examination/lastAudit",
                type: 'post',
                data: { "": T_ReportNumber },
                success: function (data) {
                    if (data.code == 0) {
                        parent.layer.msg(data.msg, { icon: 2, time: 1000 });
                    }
                    else {
                        parent.layer.msg("导出成功！", { icon: 1, time: 1000 });
                        location.href = "" + ApiUrl + data.msg;
                    }
                }
            });

            //location.href=''
        };

    </script>
</body>
</html>
